<!DOCTYPE html>
<html xmlns="https://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	
	<h2>上传图片</h2>
	<form id="form1">
		<div>选择图片:<input type="file" name="fileName"/></div>
	</form>
	<button id="submit" value="提交"> 提交</button>
	
	<a href="/file/down" download>下载</button>
	<script src="/js/jquery.min.js"></script>
	<script type="text/javascript">
	$(function(){
		$("#download").click(function(){
			$.ajax({
   				type: "POST",
   				url: "/file/down",
   				data: formData,
   				processData: false,
   				contentType: false,
   				success:function(data){
   					alert(data)
   				}
   			})
		}),
   		$("#submit").click(function(){
   			console.log("!23")
   			var formData = new FormData($("#form1")[0]);
   			$.ajax({
   				type: "POST",
   				url: "/file/upload",
   				data: formData,
   				processData: false,
   				contentType: false,
   				success:function(data){
   					alert(data)
   				}
   			})
   		});
   	})
	</script>
</body>
</html>